﻿/*
 *Author: Jeff Liu 
 *
 *Under MIT License
 *jebberwocky@gmail.com
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CtpGglMap.Impl;
using System.Drawing;

namespace CtpGglMap.Plus
{
    /// <summary>
    /// Subclass of GMarker. For features which not been included in original Google API
    /// </summary>
    public class GMarkerPlus: GMarker
    {
        public String Title { get; set; }

        /// <summary>
        /// The font, font size of title
        /// Default: Tahoma, 10
        /// </summary>
        public Font TitleFont { get; set; }

        /// <summary>
        /// The color of font
        /// Default: Black
        /// </summary>
        public Brush TitleBrush { get; set; }

        public GMarkerPlus()
        {
            this.TitleFont = new Font("Tahoma", 10);
            this.TitleBrush = Brushes.Black;
        }

        /// <summary>
        /// Convert Pixl to pointF
        /// refer: http://stackoverflow.com/questions/139655/how-to-convert-pixels-to-points-px-to-pt-in-net-c
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        public PointF GetPointF(Graphics g)
        {
            if (this.PixelXY != null)
            {
                float x = this.PixelXY.X + 1 * 72 / g.DpiX;
                float y = this.PixelXY.Y + 1 * 72 / g.DpiY;
                return new PointF(x, y);
            }
            return PointF.Empty;
        }
    }
}
